package com.april.pattern.structural.composite;

import org.junit.jupiter.api.Test;

/**
 * @author April
 * @version V1.0.0
 * @date 2019/07/04 16:50
 * @description
 */
public class CompositeTest {
    @Test
    public void compositeTest() {
        FolderImpl folder = new FolderImpl("我的收藏");
        FolderImpl avi = new FolderImpl("视频");

        AbstractFileCombination fileOne, fileTwo, fileThree, fileFour, fileFive, fileSix;

        fileOne = new ImageFileImpl("第一张图片");
        fileTwo = new TextFileImpl("文本文件");
        fileThree = new VideoFileImpl("笑傲江湖");
        fileFive = new VideoFileImpl("神雕侠侣");
        fileSix = new TextFileImpl("新建文本");
        fileFour = new FolderImpl("新文件夹");

        folder.add(fileOne);
        folder.add(fileTwo);
        avi.add(fileThree);
        avi.add(fileFive);
        fileFour.add(fileSix);

        folder.add(avi);
        folder.add(fileFour);

        folder.killVirus();
        System.out.println(folder.getFile(1));

        fileFive.getFile(0);
    }
}
